﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Acms.Bll;

public partial class Templates_AboutUs_Default : BaseTemplatePage
{
    protected override void AttachEvents()
    {
        ucExplore.DataRequired += new EventHandler(ucExplore_DataRequired);
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataBind();
        }
        
    }

    public override void DataBind()
    {
        dlOffices.DataSource = Post.GetAllBySiteIdAndParentPath(AcmsContext.SiteId, "~/Offices", AcmsContext.SiteVersion);
        if (AcmsContext.CurrentPost != null)
        {
            ucExplore.Title = AcmsContext.CurrentPost.DisplayName;
        }
        else
        {
            ucExplore.Title = "Display Name Here";
        }
        base.DataBind();
    }

    void ucExplore_DataRequired(object sender, EventArgs e)
    {
        if (AcmsContext.CurrentPost != null)
        {
            ucExplore.DataSource = AcmsContext.CurrentPost.Children;
        }
        else
        {
            ucExplore.DataSource = Acms.Bll.DummyPost.CreateDummyList(14);
        }
    }
}
